﻿using InChatter.Service.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace InChatter.Service
{
    [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IChatCallback), Namespace = "https://inchatter.codeplex.com/")]
    public interface IChat
    {
        [OperationContract(IsOneWay=false,IsInitiating=true,IsTerminating=false)]
        bool Login(string clientId);

        [OperationContract(IsOneWay=true,IsInitiating=false,IsTerminating=false)]
        void SendMsg(InChatterMessage message);

        [OperationContract(IsOneWay = false, IsInitiating = false, IsTerminating = false)]
        string GetOnlineClient();

        [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]
        void SynchronousAllClients(string allClients);

        [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]
        void ReceiveLeaveMsg();

        [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = true)]
        void Logout(string clientId);
    }

    public interface IChatCallback
    {
        [OperationContract(IsOneWay=true)]
        void ReceiveMsg(InChatterMessage message);
    }

}
